Saves all currently open images in a folder using '0001', '0002', etc.
as the file names. The save file dialog box will be displayed once
so that you can specify the folder to save the files in.
}
var
n:integer;
begin
for n:=1 to nPics do begin
SelectPic(n);
SetPicName(n:2);
SaveAs;
{Export;}
end;
end;
macro 'Import FITS';
{
This is an example of how to decode an image file header. In this case, the header is 2880 bytes long and bytes 266-269 contain the width(ASCII) and bytes
246-249 cantain the height. Refer to "FITS:A Flexible Image Transport System",
Astronomy and Astrophysics Supplement Series 44, 1981, 363-370.
}
var
width,height,offset,i,d,m:integer;
begin
width:=512;
height:=1;
offset:=0;
SetImport('8-bit');
SetCustom(width,height,offset);
Import(''); {Read in header as an image, prompting for the file name.}
if not ((GetPixel(108,0)=49) and (GetPixel(109,0)=54)) then begin
{BITPIX<>16}
PutMessage('This macro only reads 16-bit FITS files');
Dispose(nPics);
exit;
end;
m:=1000;
width:=0;
for i:=266 to 269 do begin
d:=GetPixel(i,0);
if d=32 then d:=48;
d:=d-48;
width:=width+d*m;
m:=m/10;
end;
m:=1000;
height:=0;
for i:=346 to 349 do begin
d:=GetPixel(i,0);
if d=32 then d:=48;
d:=d-48;
height:=height+d*m;
m:=m/10;
end;
Dispose(nPics); {The ID of the last window opened is equal to nPics.}
offset:=2880;
SetImport('16-bit Signed; Calibrate; Autoscale');
SetCustom(width,height,offset);
Import(''); {No prompt this time; Import remembers the name.}
FlipVertical;
end;
macro 'Import Image TIFF File';
{
As an example of how to import a foreign file format, this macro reads
the TIFF files created by Image. The format of an Image TIFF file
is described in Appendix E of the Image manual.
}
var
width,height,offset:integer;
begin
width:=768;
height:=1;
offset:=0;
SetImport('8-bit');
SetCustom(width,height,offset);
Import(''); {Read in header as an image, prompting for the file name.}
if not ((GetPixel(0,0)=77) and (GetPixel(0,0)=77)) then begin {'MM'}
PutMessage('This is not a TIFF file.');
Dispose(nPics);
exit;
end;
width := (GetPixel(30,0)*256) + GetPixel(31,0);
height := (GetPixel(42,0)*256) + GetPixel(43,0);
Dispose(nPics); {The ID of the last window opened is equal to nPics.}
offset:=768;
SetCustom(width,height,offset);
Import(''); {No prompt this time; Import remembers the name.}
end;
macro 'Import Multiple Images per File';
{
Imports a series of 256x256 images contained in a single file, in this
case an NIH Image stack with an arbitrary number of 256x256 slices.
}
var
offset,i,PicSize,HdrSize,width,height:integer;
begin
HdrSize:= 768;
width:= 256;
height:=256;
PicSize:=width*height;
offset:=HdrSize;
SetImport('8-bit');
for I:=1 to 100 do begin {Macro will terminate at eof}
SetCustom(width,height,offset);
Import('');
offset:=offset+PicSize;
end;
end;
macro 'Import PET';
var
offset,i,PicSize,HdrSize,width,height:integer;
begin
HdrSize:= 0;
width:= 128;
height:=128;
PicSize:=width*height;
offset:=HdrSize;
SetImport('8-bit');
for I:=1 to 100 do begin {Macro will terminate at eof}
SetCustom(width,height,offset);
Import('');
offset:=offset+PicSize;
end;
end;
macro 'Import GE Signa Files';
Var
i,n,max,stack,first:integer;
begin
first:=round(GetNumber('Number of first slice:',1));